package com.cskaoyan.demo.controller;

import com.cskaoyan.demo.bean.BaseRespVo;
import com.cskaoyan.demo.bean.InfoData;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Map;

@RestController
@RequestMapping("admin/auth")
public class AuthController {

    /**
     * 当前由我提供，shiro之后大家自己把业务补充完整
     */
    @RequestMapping("/login")
    public BaseRespVo login(@RequestBody Map user){

        return BaseRespVo.ok("8d3aad48-81b1-482d-ad8f-a58afd98ad75");
    }

    @RequestMapping("/info")
    public BaseRespVo info(String token){
        InfoData infoData = new InfoData();
        infoData.setAvatar("https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        infoData.setName("admin123");
        ArrayList<String> perms = new ArrayList<>();
        perms.add("*");//权限

        infoData.setPerms(perms);
        ArrayList<String> roles = new ArrayList<>();
        roles.add("超级管理员");
        infoData.setRoles(roles);
        return BaseRespVo.ok(infoData);
    }
}
